<!DOCTYPE html>
<script>
  const channel = new MessageChannel();
  window.parent.postMessage(channel.port2, '*', [channel.port2]);
  channel.port1.onmessage = e => { channel.port1.postMessage("message event received") };
  channel.port1.onmessageerror = () => channel.port1.postMessage("messageerror event received");
</script>
